﻿using System.Collections.ObjectModel;

namespace ServerCrafter.ClassLibrary.ViewModels
{
    public class Plugin
    {
        public Plugin(int index, string name, string pluginVersion, string gameVersion, string type, string status,
                      string releaseDate, string slug, string description, string categories)
        {
            Index = index;
            Name = name;
            PluginVersion = pluginVersion;
            GameVersion = gameVersion;
            Type = type;
            Status = status;
            ReleaseDate = releaseDate;
            Slug = slug;
            Description = description;
            Categories = categories;
        }

        public int Index { get; set; }

        public string Name { get; set; }

        public string PluginVersion { get; set; }

        public string GameVersion { get; set; }

        public string Type { get; set; }

        public string Status { get; set; }

        public string ReleaseDate { get; set; }

        public string Slug { get; set; }

        public string Description { get; set; }

        public string Categories { get; set; }
    }

    public class VmPlugins
    {
        public ObservableCollection<Plugin> Plugins { get; set; }

        public ObservableCollection<Plugin> Get()
        {
            Plugins = new ObservableCollection<Plugin>();
            for (var index = 0; index < PluginManager.Plugins.Count; index++)
            {
                Plugins.Add
                    (
                        new Plugin
                            (
                            index,
                            PluginManager.Plugins.List[index, 0],
                            PluginManager.Plugins.List[index, 4],
                            PluginManager.Plugins.List[index, 5],
                            PluginManager.Plugins.List[index, 6],
                            PluginManager.Plugins.List[index, 7],
                            PluginManager.Plugins.List[index, 8],
                            PluginManager.Plugins.List[index, 1],
                            PluginManager.Plugins.List[index, 2],
                            PluginManager.Plugins.List[index, 10]
                            )
                    );
            }
            return Plugins;
        }
    }
}